var hdtake = function () {
    //"use strict";
    this.init = function () {
        this.updateTake();
        $("#btnTakeCancel").click(function () {
            $("#txtTakeSum").val("");       
        });
        $("#btnTakeSum").click(function (e) {
			var tempSum = "", str, i, temp;
			str = $("#txtTakeSum").val().split(',');
			for (i = 0; i < str.length; i += 1) {
				tempSum += str[i];
			}
            temp = {
				Sum: parseFloat(tempSum),
                AccountID: parseInt($("#selAccountAddSum option:selected").val())
			};
			data.takeNewSum(temp);
            $("#txtTakeSum").val("");
            hdcurrentstate.show();
        });
	};
    this.updateTake = function(){
        data.getAccountList( function (results) {
            var i, num, str = "";
            num = results.rows.length;
            if (num !== 0) {
                for(i=0; i < num; i += 1){
                    str += "<option value='" + results.rows.item(i).AccountID + "'>" + results.rows.item(i).Name + "</option>";
                }
                $("#selAccountSpendSum").html(str).selectmenu('refresh');
            }
        });
    };
    this.init();
    return this;
}(hdtake || {});